using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;

using miciv;
using micivCore.Components;
using micivCore.Faction;

namespace micivCore.Player
{
    abstract public class PlayerBase : IPlayer
    {
        protected CoreContext m_coreContext;
        protected Level.Level m_level;
        protected PlayerDescription m_desc;
        protected Faction.Faction m_faction;

        public PlayerBase(CoreContext _coreContext, Level.Level _level, PlayerDescription _desc)
        {
            this.m_coreContext = _coreContext;
            this.m_level = _level;
            this.m_desc = _desc;
        }

        virtual public bool Initialize(XmlElement _xmlPlayer)
        {
            return true;
        }

        #region IPlayer Members

        virtual public string ID
        {
            get
            {
                return this.m_desc.ID;
            }
        }

        virtual public string NickName
        {
            get
            {
                return this.m_desc.NickName;
            }
        }

        public Faction.Faction Faction
        {
            get
            {
                return this.m_desc.Faction;
            }
        }

        virtual public IMapCommunicator MapCommunicator
        {
            get
            {
                return this.m_level.MapCommunicator;
            }
        }

        public CoreContext CoreContext
        {
            get
            {
                return this.m_level.CoreContext;
            }
        }

        virtual public void Activate()
        {

        }

        virtual public void Update()
        {

        }

        virtual public void Deactivate()
        {

        }

        virtual public void Release()
        {

        }

        #endregion
    }
}
